﻿using Architecture.Api.Application.Commands.DeepProcessingCommand;
using Architecture.Api.Application.Commands.ImmuneInFormationCommand;
using Architecture.Api.Application.Commands.SupplierCommand;
using Architecture.Domain.TraceabilityManage;
using Architecture.Domian.DTO;
using Architecture.Domian.Entity;
using AutoMapper;

namespace Architecture.Api.Extensions
{
    public static partial class ServiceCollectionExtensions
    {
        public class ServiceProfile : Profile
        {
            public ServiceProfile()
            {
                //第一个参数类型是源类型(这里是Model类型)，第二个参数是目标类型(这里是DTO类型)
                //CreateMap<Student, StudentDTO>().ReverseMap();
                CreateMap<ImmuneInFormation, ImmuneInFormationCreateCommand>().ReverseMap();
                CreateMap<ImmuneInFormation, ImmuneInFormationUpdateCommand>().ReverseMap();
                CreateMap<DeepProcessing, DeepProcessingCreateCommand>().ReverseMap();
                CreateMap<DeepProcessing, DeepProcessingUpdateCommand>().ReverseMap();
                CreateMap<Supplier, SupplierBatchCommand>().ReverseMap();

                CreateMap<Student, StudentDTO>().ForMember(destinationMember: des => des.StuDTOId,
                    memberOptions: opt => { opt.MapFrom(mapExpression: map => map.Id); }).ReverseMap();
            }
        }
    }
}
